#import <Foundation/Foundation.h>
#import "Foursquare.h"
#import "SFUConstants.h"
#import "GraphicsUtilities.h"
#import "FoursquareLoginDelegate.h"

//  This Foursquare integration is possible thanks to the Foursquare API by
//  Eric Butler and associates.
//
//  Copyright (C) 2010 Eric Butler <eric@codebutler.com>
//
//  FoursquareLogin is created with much reference to Constantine Fry's sample
//  classes in the Foursquare API.
//
//  Created by Constantine Fry on 10/10/10.
//  Copyright 2010 Home. All rights reserved.

/**
 * A FoursquareLogin is a tool for logging in to the Foursquare system.
 *
 * Code used within this class and the supporting API was written by 
 * Eric Butler, Constantine Fry, and other associates.
 *
 * The supporting API can be found in ./FourSquareAPI folder.
 *
 * @author      Eric Butler
 * @author      Constantine Fry
 * @author      James Lin
 * @version     2.3.2
 * @since       2.0.0
 */
@interface FoursquareLogin : UIView <UIAlertViewDelegate, UITextFieldDelegate> {
	id<FoursquareLoginDelegate> delegate;         // Delegate handling login response
	BOOL                        _isLoggedIn;      // Whether the user is logged in
	UIButton*                   loginButton;      // Foursquare login button
	UIAlertView*                loginPopup;       // View for the login pop-up
	UIImageView*                signInHeader;     // Image header for Foursquare login
	UIImageView*                poweredByHeader;  // Image header for sourcing Foursquare
	UIActivityIndicatorView*    loginIndicator;   // Indicator for login status
	UITextField*                userField;        // Text field for the login username
	UITextField*                passwordField;    // Text field for the login password
	UIButton*                   signInButton;     // Sign in button for login pop-up
	UIButton*                   cancelButton;     // Cancel button for login pop-up
	UILabel*                    loginStatusLabel; // Label for login status
}

@property (getter=checkLoggedIn) BOOL isLoggedIn;

/**
 * Retrieve the shared instance of the Foursquare login.
 *
 * @return  the shared instance of FoursquareLogin
 */
+ (FoursquareLogin*)sharedFoursquareLogin;

/**
 * Display the login pop-up.
 *
 * @param theDelegate  the delegate handling login response
 */
- (void)showLoginWithDelegate:(id<FoursquareLoginDelegate>)theDelegate;

/**
 * Login to the Foursquare system with given user account information.
 *
 * @param user      the account identifier of the user account
 * @param password  the password of the user account
 */
- (void)loginWithUser:(NSString*)user password:(NSString*)password;

/**
 * Log out of the Foursquare system with currently authenticated user.
 */
- (void)logout;

@end